home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 July: Mac OS SDK / Dev.CD Jul 99 SDK1.toast / Development Kits / Mac OS / QuickTime / QuickTime 3 Interfaces & Libs / QTDevMac / CIncludes / QD3D.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-08-21  |  40.7 KB  |  1,195 lines  |  [TEXT/MPS ]

  1. /*
  2.      File:        QD3D.h
  3.  
  4.      Contains:    Base types for Quickdraw 3D                            
  5.  
  6.      Version:    Technology:    Quickdraw 3D 1.5.4
  7.                  Release:    QuickTime 3.0
  8.  
  9.      Copyright:    © 1995-1998 by Apple Computer, Inc., all rights reserved.
  10.  
  11.      Bugs?:        Please include the the file and version information (from above) with
  12.                  the problem description.  Developers belonging to one of the Apple
  13.                  developer programs can submit bug reports to:
  14.  
  15.                      devsupport@apple.com
  16.  
  17. */
  18. #ifndef __QD3D__
  19. #define __QD3D__
  20.  
  21. #ifndef __CONDITIONALMACROS__
  22. #include <ConditionalMacros.h>
  23. #endif
  24.  
  25. #if TARGET_OS_MAC
  26. #ifndef __MACTYPES__
  27. #include <MacTypes.h>
  28. #endif
  29. #endif  /* TARGET_OS_MAC */
  30.  
  31. #include <stdio.h>
  32.  
  33.  
  34. #if PRAGMA_ONCE
  35. #pragma once
  36. #endif
  37.  
  38. #ifdef __cplusplus
  39. extern "C" {
  40. #endif
  41.  
  42. #if PRAGMA_IMPORT
  43. #pragma import on
  44. #endif
  45.  
  46. #if PRAGMA_STRUCT_ALIGN
  47.     #pragma options align=power
  48. #elif PRAGMA_STRUCT_PACKPUSH
  49.     #pragma pack(push, 2)
  50. #elif PRAGMA_STRUCT_PACK
  51.     #pragma pack(2)
  52. #endif
  53.  
  54. #if PRAGMA_ENUM_ALWAYSINT
  55.     #pragma enumsalwaysint on
  56. #elif PRAGMA_ENUM_OPTIONS
  57.     #pragma option enum=int
  58. #elif PRAGMA_ENUM_PACK
  59.     #if __option(pack_enums)
  60.         #define PRAGMA_ENUM_PACK__QD3D__
  61.     #endif
  62.     #pragma options(!pack_enums)
  63. #endif
  64.  
  65. #if TARGET_OS_MAC
  66. #define OS_MACINTOSH 1
  67. #define OS_WIN32 0
  68. #define OS_UNIX 0
  69. #define OS_NEXT 0
  70. #define WINDOW_SYSTEM_MACINTOSH 1
  71. #define WINDOW_SYSTEM_WIN32 0
  72. #define WINDOW_SYSTEM_X11 0
  73. #define WINDOW_SYSTEM_NEXT 0
  74. #endif  /* TARGET_OS_MAC */
  75.  
  76. #if TARGET_OS_WIN32
  77. #define OS_MACINTOSH 0
  78. #define OS_WIN32 1
  79. #define OS_UNIX 0
  80. #define OS_NEXT 0
  81. #define WINDOW_SYSTEM_MACINTOSH 0
  82. #define WINDOW_SYSTEM_WIN32 1
  83. #define WINDOW_SYSTEM_X11 0
  84. #define WINDOW_SYSTEM_NEXT 0
  85. #endif  /* TARGET_OS_WIN32 */
  86.  
  87. #if TARGET_OS_UNIX
  88. #define OS_MACINTOSH 0
  89. #define OS_WIN32 0
  90. #define WINDOW_SYSTEM_MACINTOSH 0
  91. #define WINDOW_SYSTEM_WIN32 0
  92. #if NeXT
  93. #define OS_UNIX 0
  94. #define OS_NEXT 1
  95. #define WINDOW_SYSTEM_X11 0
  96. #define WINDOW_SYSTEM_NEXT 1
  97. #else
  98. #define OS_UNIX 1
  99. #define OS_NEXT 0
  100. #define WINDOW_SYSTEM_X11 1
  101. #define WINDOW_SYSTEM_NEXT 0
  102. #endif  /* NeXT */
  103.  
  104. #endif  /* TARGET_OS_UNIX */
  105.  
  106.  
  107. /******************************************************************************
  108.  **                                                                             **
  109.  **                                Export Control                                 **
  110.  **                                                                             **
  111.  *****************************************************************************/
  112. #if TARGET_OS_WIN32
  113.     #if defined(WIN32_EXPORTING)    /* define when building DLL */
  114.         #define QD3D_EXPORT __declspec( dllexport )     
  115.         #define QD3D_CALL    
  116.         #define QD3D_CALLBACK    
  117.     #else
  118.         #define QD3D_EXPORT __declspec( dllimport )    
  119.         #define QD3D_CALL    __cdecl
  120.         #define QD3D_CALLBACK    __cdecl    
  121.     #endif /* WIN32_EXPORTING */
  122. #else
  123.     #define QD3D_EXPORT
  124.     #define QD3D_CALL    
  125.     #define QD3D_CALLBACK    
  126. #endif  /*  TARGET_OS_WIN32  */
  127.  
  128.  
  129. /******************************************************************************
  130.  **                                                                             **
  131.  **                                NULL definition                                 **
  132.  **                                                                             **
  133.  *****************************************************************************/
  134.  
  135. #ifndef NULL
  136.     #error /*    NULL is undefined?    */
  137. #endif /* NULL */
  138.  
  139. /******************************************************************************
  140.  **                                                                             **
  141.  **                                    Objects                                     **
  142.  **                                                                             **
  143.  *****************************************************************************/
  144. /*
  145.  * Everything in QuickDraw 3D is an OBJECT: a bunch of data with a type,
  146.  * deletion, duplication, and i/o methods.
  147.  */
  148. typedef long                             TQ3ObjectType;
  149. typedef struct OpaqueTQ3Object*         TQ3Object;
  150. /* */
  151. /*
  152.  * There are four subclasses of OBJECT:
  153.  *    an ELEMENT, which is data that is placed in a SET
  154.  *    a SHAREDOBJECT, which is reference-counted data that is shared
  155.  *    VIEWs, which maintain state information for an image
  156.  *    a PICK, which used to query a VIEW
  157.  */
  158. typedef TQ3Object                         TQ3ElementObject;
  159. typedef TQ3Object                         TQ3SharedObject;
  160. typedef TQ3Object                         TQ3ViewObject;
  161. typedef TQ3Object                         TQ3PickObject;
  162. /*
  163.  * There are several types of SharedObjects:
  164.  *    RENDERERs, which paint to a drawContext
  165.  *    DRAWCONTEXTs, which are an interface to a device 
  166.  *    SETs, which maintains "mathematical sets" of ELEMENTs
  167.  *    FILEs, which maintain state information for a metafile
  168.  *    SHAPEs, which affect the state of the View
  169.  *    SHAPEPARTs, which contain geometry-specific data about a picking hit
  170.  *    CONTROLLERSTATEs, which hold state of the output channels for a CONTROLLER
  171.  *    TRACKERs, which represent a position and orientation in the user interface
  172.  *  STRINGs, which are abstractions of text string data.
  173.  *    STORAGE, which is an abstraction for stream-based data storage (files, memory)
  174.  *    TEXTUREs, for sharing bitmap information for TEXTURESHADERS
  175.  *    VIEWHINTs, which specifies viewing preferences in FILEs
  176.  */
  177. typedef TQ3SharedObject                 TQ3RendererObject;
  178. typedef TQ3SharedObject                 TQ3DrawContextObject;
  179. typedef TQ3SharedObject                 TQ3SetObject;
  180. typedef TQ3SharedObject                 TQ3FileObject;
  181. typedef TQ3SharedObject                 TQ3ShapeObject;
  182. typedef TQ3SharedObject                 TQ3ShapePartObject;
  183. typedef TQ3SharedObject                 TQ3ControllerStateObject;
  184. typedef TQ3SharedObject                 TQ3TrackerObject;
  185. typedef TQ3SharedObject                 TQ3StringObject;
  186. typedef TQ3SharedObject                 TQ3StorageObject;
  187. typedef TQ3SharedObject                 TQ3TextureObject;
  188. typedef TQ3SharedObject                 TQ3ViewHintsObject;
  189. /*
  190.  * There is one types of SET:
  191.  *    ATTRIBUTESETs, which contain ATTRIBUTEs which are inherited 
  192.  */
  193. typedef TQ3SetObject                     TQ3AttributeSet;
  194. /*
  195.  * There are many types of SHAPEs:
  196.  *    LIGHTs, which affect how the RENDERER draws 3-D cues
  197.  *    CAMERAs, which affects the location and orientation of the RENDERER in space
  198.  *    GROUPs, which may contain any number of SHARED OBJECTS
  199.  *    GEOMETRYs, which are representations of three-dimensional data
  200.  *    SHADERs, which affect how colors are drawn on a geometry
  201.  *    STYLEs, which affect how the RENDERER paints to the DRAWCONTEXT
  202.  *    TRANSFORMs, which affect the coordinate system in the VIEW
  203.  *    REFERENCEs, which are references to objects in FILEs
  204.  *  UNKNOWN, which hold unknown objects read from a metafile.
  205.  */
  206. typedef TQ3ShapeObject                     TQ3GroupObject;
  207. typedef TQ3ShapeObject                     TQ3GeometryObject;
  208. typedef TQ3ShapeObject                     TQ3ShaderObject;
  209. typedef TQ3ShapeObject                     TQ3StyleObject;
  210. typedef TQ3ShapeObject                     TQ3TransformObject;
  211. typedef TQ3ShapeObject                     TQ3LightObject;
  212. typedef TQ3ShapeObject                     TQ3CameraObject;
  213. typedef TQ3ShapeObject                     TQ3UnknownObject;
  214. typedef TQ3ShapeObject                     TQ3ReferenceObject;
  215. /*
  216.  * For now, there is only one type of SHAPEPARTs:
  217.  *    MESHPARTs, which describe some part of a mesh
  218.  */
  219. typedef TQ3ShapePartObject                 TQ3MeshPartObject;
  220. /*
  221.  * There are three types of MESHPARTs:
  222.  *    MESHFACEPARTs, which describe a face of a mesh
  223.  *    MESHEDGEPARTs, which describe a edge of a mesh
  224.  *    MESHVERTEXPARTs, which describe a vertex of a mesh
  225.  */
  226. typedef TQ3MeshPartObject                 TQ3MeshFacePartObject;
  227. typedef TQ3MeshPartObject                 TQ3MeshEdgePartObject;
  228. typedef TQ3MeshPartObject                 TQ3MeshVertexPartObject;
  229. /*
  230.  * A DISPLAY Group can be drawn to a view
  231.  */
  232. typedef TQ3GroupObject                     TQ3DisplayGroupObject;
  233. /*
  234.  * There are many types of SHADERs:
  235.  *    SURFACESHADERs, which affect how the surface of a geometry is painted
  236.  *    ILLUMINATIONSHADERs, which affect how lights affect the color of a surface
  237.  */
  238. typedef TQ3ShaderObject                 TQ3SurfaceShaderObject;
  239. typedef TQ3ShaderObject                 TQ3IlluminationShaderObject;
  240. /*
  241.  * A handle to an object in a group
  242.  */
  243. typedef struct OpaqueTQ3GroupPosition*     TQ3GroupPosition;
  244. /* 
  245.  * TQ3ObjectClassNameString is used for the class name of an object
  246.  */
  247.  
  248. enum {
  249.     kQ3StringMaximumLength        = 1024
  250. };
  251.  
  252.  
  253. typedef char TQ3ObjectClassNameString[kQ3StringMaximumLength];
  254.  
  255.  
  256. /******************************************************************************
  257.  **                                                                             **
  258.  **                            Client/Server Things                             **
  259.  **                                                                             **
  260.  *****************************************************************************/
  261. typedef void *                            TQ3ControllerRef;
  262. /******************************************************************************
  263.  **                                                                             **
  264.  **                            Flags and Switches                                 **
  265.  **                                                                             **
  266.  *****************************************************************************/
  267.  
  268. enum TQ3Boolean {
  269.     kQ3False                    = 0,
  270.     kQ3True                        = 1
  271. };
  272. typedef enum TQ3Boolean TQ3Boolean;
  273.  
  274.  
  275. enum TQ3Switch {
  276.     kQ3Off                        = 0,
  277.     kQ3On                        = 1
  278. };
  279. typedef enum TQ3Switch TQ3Switch;
  280.  
  281.  
  282. enum TQ3Status {
  283.     kQ3Failure                    = 0,
  284.     kQ3Success                    = 1
  285. };
  286. typedef enum TQ3Status TQ3Status;
  287.  
  288.  
  289. enum TQ3Axis {
  290.     kQ3AxisX                    = 0,
  291.     kQ3AxisY                    = 1,
  292.     kQ3AxisZ                    = 2
  293. };
  294. typedef enum TQ3Axis TQ3Axis;
  295.  
  296.  
  297. enum TQ3PixelType {
  298.     kQ3PixelTypeRGB32            = 0,                            /* Alpha:8 (ignored), R:8, G:8, B:8    */
  299.     kQ3PixelTypeARGB32            = 1,                            /* Alpha:8, R:8, G:8, B:8             */
  300.     kQ3PixelTypeRGB16            = 2,                            /* Alpha:1 (ignored), R:5, G:5, B:5    */
  301.     kQ3PixelTypeARGB16            = 3,                            /* Alpha:1, R:5, G:5, B:5             */
  302.     kQ3PixelTypeRGB16_565        = 4,                            /* Win32 only: 16 bits/pixel, R:5, G:6, B:5        */
  303.     kQ3PixelTypeRGB24            = 5                                /* Win32 only: 24 bits/pixel, R:8, G:8, B:8        */
  304. };
  305. typedef enum TQ3PixelType TQ3PixelType;
  306.  
  307.  
  308. enum TQ3Endian {
  309.     kQ3EndianBig                = 0,
  310.     kQ3EndianLittle                = 1
  311. };
  312. typedef enum TQ3Endian TQ3Endian;
  313.  
  314.  
  315. enum TQ3EndCapMasks {
  316.     kQ3EndCapNone                = 0,
  317.     kQ3EndCapMaskTop            = 1 << 0,
  318.     kQ3EndCapMaskBottom            = 1 << 1,
  319.     kQ3EndCapMaskInterior        = 1 << 2
  320. };
  321. typedef enum TQ3EndCapMasks TQ3EndCapMasks;
  322.  
  323. typedef unsigned long                     TQ3EndCap;
  324.  
  325. enum {
  326.     kQ3ArrayIndexNULL = ~0    
  327. };
  328.  
  329.  
  330. /******************************************************************************
  331.  **                                                                             **
  332.  **                        Point and Vector Definitions                         **
  333.  **                                                                             **
  334.  *****************************************************************************/
  335.  
  336. struct TQ3Vector2D {
  337.     float                             x;
  338.     float                             y;
  339. };
  340. typedef struct TQ3Vector2D                TQ3Vector2D;
  341.  
  342. struct TQ3Vector3D {
  343.     float                             x;
  344.     float                             y;
  345.     float                             z;
  346. };
  347. typedef struct TQ3Vector3D                TQ3Vector3D;
  348.  
  349. struct TQ3Point2D {
  350.     float                             x;
  351.     float                             y;
  352. };
  353. typedef struct TQ3Point2D                TQ3Point2D;
  354.  
  355. struct TQ3Point3D {
  356.     float                             x;
  357.     float                             y;
  358.     float                             z;
  359. };
  360. typedef struct TQ3Point3D                TQ3Point3D;
  361.  
  362. struct TQ3RationalPoint4D {
  363.     float                             x;
  364.     float                             y;
  365.     float                             z;
  366.     float                             w;
  367. };
  368. typedef struct TQ3RationalPoint4D        TQ3RationalPoint4D;
  369.  
  370. struct TQ3RationalPoint3D {
  371.     float                             x;
  372.     float                             y;
  373.     float                             w;
  374. };
  375. typedef struct TQ3RationalPoint3D        TQ3RationalPoint3D;
  376. /******************************************************************************
  377.  **                                                                             **
  378.  **                                Quaternion                                     **
  379.  **                                                                             **
  380.  *****************************************************************************/
  381.  
  382. struct TQ3Quaternion {
  383.     float                             w;
  384.     float                             x;
  385.     float                             y;
  386.     float                             z;
  387. };
  388. typedef struct TQ3Quaternion            TQ3Quaternion;
  389. /******************************************************************************
  390.  **                                                                             **
  391.  **                                Ray Definition                                 **
  392.  **                                                                             **
  393.  *****************************************************************************/
  394.  
  395. struct TQ3Ray3D {
  396.     TQ3Point3D                         origin;
  397.     TQ3Vector3D                     direction;
  398. };
  399. typedef struct TQ3Ray3D                    TQ3Ray3D;
  400. /******************************************************************************
  401.  **                                                                             **
  402.  **                        Parameterization Data Structures                     **
  403.  **                                                                             **
  404.  *****************************************************************************/
  405.  
  406. struct TQ3Param2D {
  407.     float                             u;
  408.     float                             v;
  409. };
  410. typedef struct TQ3Param2D                TQ3Param2D;
  411.  
  412. struct TQ3Param3D {
  413.     float                             u;
  414.     float                             v;
  415.     float                             w;
  416. };
  417. typedef struct TQ3Param3D                TQ3Param3D;
  418.  
  419. struct TQ3Tangent2D {
  420.     TQ3Vector3D                     uTangent;
  421.     TQ3Vector3D                     vTangent;
  422. };
  423. typedef struct TQ3Tangent2D                TQ3Tangent2D;
  424.  
  425. struct TQ3Tangent3D {
  426.     TQ3Vector3D                     uTangent;
  427.     TQ3Vector3D                     vTangent;
  428.     TQ3Vector3D                     wTangent;
  429. };
  430. typedef struct TQ3Tangent3D                TQ3Tangent3D;
  431. /******************************************************************************
  432.  **                                                                             **
  433.  **                        Polar and Spherical Coordinates                         **
  434.  **                                                                             **
  435.  *****************************************************************************/
  436.  
  437. struct TQ3PolarPoint {
  438.     float                             r;
  439.     float                             theta;
  440. };
  441. typedef struct TQ3PolarPoint            TQ3PolarPoint;
  442.  
  443. struct TQ3SphericalPoint {
  444.     float                             rho;
  445.     float                             theta;
  446.     float                             phi;
  447. };
  448. typedef struct TQ3SphericalPoint        TQ3SphericalPoint;
  449. /******************************************************************************
  450.  **                                                                             **
  451.  **                            Color Definition                                 **
  452.  **                                                                             **
  453.  *****************************************************************************/
  454.  
  455. struct TQ3ColorRGB {
  456.     float                             r;
  457.     float                             g;
  458.     float                             b;
  459. };
  460. typedef struct TQ3ColorRGB                TQ3ColorRGB;
  461.  
  462. struct TQ3ColorARGB {
  463.     float                             a;
  464.     float                             r;
  465.     float                             g;
  466.     float                             b;
  467. };
  468. typedef struct TQ3ColorARGB                TQ3ColorARGB;
  469. /******************************************************************************
  470.  **                                                                             **
  471.  **                                    Vertices                                 **
  472.  **                                                                             **
  473.  *****************************************************************************/
  474.  
  475. struct TQ3Vertex3D {
  476.     TQ3Point3D                         point;
  477.     TQ3AttributeSet                 attributeSet;
  478. };
  479. typedef struct TQ3Vertex3D                TQ3Vertex3D;
  480. /******************************************************************************
  481.  **                                                                             **
  482.  **                                    Matrices                                 **
  483.  **                                                                             **
  484.  *****************************************************************************/
  485.  
  486. struct TQ3Matrix3x3 {
  487.     float                             value[3][3];
  488. };
  489. typedef struct TQ3Matrix3x3                TQ3Matrix3x3;
  490.  
  491. struct TQ3Matrix4x4 {
  492.     float                             value[4][4];
  493. };
  494. typedef struct TQ3Matrix4x4                TQ3Matrix4x4;
  495. /******************************************************************************
  496.  **                                                                             **
  497.  **                                Bitmap/Pixmap                                 **
  498.  **                                                                             **
  499.  *****************************************************************************/
  500.  
  501. struct TQ3Pixmap {
  502.     void *                            image;
  503.     unsigned long                     width;
  504.     unsigned long                     height;
  505.     unsigned long                     rowBytes;
  506.     unsigned long                     pixelSize;                    /* MUST be 16 or 32 to use with the    Interactive Renderer on Mac OS*/
  507.     TQ3PixelType                     pixelType;
  508.     TQ3Endian                         bitOrder;
  509.     TQ3Endian                         byteOrder;
  510. };
  511. typedef struct TQ3Pixmap                TQ3Pixmap;
  512.  
  513. struct TQ3StoragePixmap {
  514.     TQ3StorageObject                 image;
  515.     unsigned long                     width;
  516.     unsigned long                     height;
  517.     unsigned long                     rowBytes;
  518.     unsigned long                     pixelSize;                    /* MUST be 16 or 32 to use with the    Interactive Renderer on Mac OS*/
  519.     TQ3PixelType                     pixelType;
  520.     TQ3Endian                         bitOrder;
  521.     TQ3Endian                         byteOrder;
  522. };
  523. typedef struct TQ3StoragePixmap            TQ3StoragePixmap;
  524.  
  525. struct TQ3Bitmap {
  526.     unsigned char *                    image;
  527.     unsigned long                     width;
  528.     unsigned long                     height;
  529.     unsigned long                     rowBytes;
  530.     TQ3Endian                         bitOrder;
  531. };
  532. typedef struct TQ3Bitmap                TQ3Bitmap;
  533.  
  534. struct TQ3MipmapImage {                                            /* An image for use as a texture mipmap  */
  535.     unsigned long                     width;                        /* Width of mipmap, must be power of 2   */
  536.     unsigned long                     height;                        /* Height of mipmap, must be power of 2  */
  537.     unsigned long                     rowBytes;                    /* Rowbytes of mipmap                    */
  538.     unsigned long                     offset;                        /* Offset from image base to this mipmap */
  539. };
  540. typedef struct TQ3MipmapImage            TQ3MipmapImage;
  541.  
  542. struct TQ3Mipmap {
  543.     TQ3StorageObject                 image;                        /* Data containing the texture map and      */
  544.                                                                 /* if (useMipmapping==kQ3True) the          */
  545.                                                                 /* mipmap data                              */
  546.     TQ3Boolean                         useMipmapping;                /* True if mipmapping should be used      */
  547.                                                                 /* and all mipmaps have been provided    */
  548.     TQ3PixelType                     pixelType;
  549.     TQ3Endian                         bitOrder;
  550.     TQ3Endian                         byteOrder;
  551.     unsigned long                     reserved;                    /* leave NULL for next version             */
  552.     TQ3MipmapImage                     mipmaps[32];                /* The actual number of mipmaps is determined from the size of the first mipmap */
  553. };
  554. typedef struct TQ3Mipmap                TQ3Mipmap;
  555.  
  556. /******************************************************************************
  557.  **                                                                             **
  558.  **                        Higher dimension quantities                             **
  559.  **                                                                             **
  560.  *****************************************************************************/
  561.  
  562. struct TQ3Area {
  563.     TQ3Point2D                         min;
  564.     TQ3Point2D                         max;
  565. };
  566. typedef struct TQ3Area                    TQ3Area;
  567.  
  568. struct TQ3PlaneEquation {
  569.     TQ3Vector3D                     normal;
  570.     float                             constant;
  571. };
  572. typedef struct TQ3PlaneEquation            TQ3PlaneEquation;
  573.  
  574. struct TQ3BoundingBox {
  575.     TQ3Point3D                         min;
  576.     TQ3Point3D                         max;
  577.     TQ3Boolean                         isEmpty;
  578. };
  579. typedef struct TQ3BoundingBox            TQ3BoundingBox;
  580.  
  581. struct TQ3BoundingSphere {
  582.     TQ3Point3D                         origin;
  583.     float                             radius;
  584.     TQ3Boolean                         isEmpty;
  585. };
  586. typedef struct TQ3BoundingSphere        TQ3BoundingSphere;
  587. /*
  588.  *    The TQ3ComputeBounds flag passed to StartBoundingBox or StartBoundingSphere
  589.  *    calls in the View. It's a hint to the system as to how it should 
  590.  *    compute the bbox of a shape:
  591.  *
  592.  *    kQ3ComputeBoundsExact:    
  593.  *        Vertices of shapes are transformed into world space and
  594.  *        the world space bounding box is computed from them.  Slow!
  595.  *    
  596.  *    kQ3ComputeBoundsApproximate: 
  597.  *        A local space bounding box is computed from a shape's
  598.  *        vertices.  This bbox is then transformed into world space,
  599.  *        and its bounding box is taken as the shape's approximate
  600.  *        bbox.  Fast but the bbox is larger than optimal.
  601.  */
  602.  
  603. enum TQ3ComputeBounds {
  604.     kQ3ComputeBoundsExact        = 0,
  605.     kQ3ComputeBoundsApproximate    = 1
  606. };
  607. typedef enum TQ3ComputeBounds TQ3ComputeBounds;
  608.  
  609.  
  610. /******************************************************************************
  611.  **                                                                             **
  612.  **                            Object System Types                                 **
  613.  **                                                                             **
  614.  *****************************************************************************/
  615.  
  616. typedef struct OpaqueTQ3XObjectClass*     TQ3XObjectClass;
  617.  
  618. typedef unsigned long                     TQ3XMethodType;
  619. /*
  620.  * Object methods
  621.  */
  622. #define kQ3XMethodTypeObjectUnregister        Q3_METHOD_TYPE('u','n','r','g')
  623. /* 
  624.  *  Return true from the metahandler if this 
  625.  *  object can be submitted in a rendering loop 
  626.  */
  627. #define kQ3XMethodTypeObjectIsDrawable        Q3_METHOD_TYPE('i','s','d','r')    /* return true from the metahandler if this object can be submitted in a rendering loop */
  628. typedef CALLBACK_API_C( void , TQ3XFunctionPointer )(void );
  629. typedef CALLBACK_API_C( TQ3XFunctionPointer , TQ3XMetaHandler )(TQ3XMethodType methodType);
  630. /*
  631.  * MetaHandler:
  632.  *        When you give a metahandler to QuickDraw 3D, it is called multiple 
  633.  *        times to build method tables, and then is thrown away. You are 
  634.  *        guaranteed that your metahandler will never be called again after a 
  635.  *        call that was passed a metahandler returns.
  636.  *
  637.  *        Your metahandler should contain a switch on the methodType passed to it
  638.  *        and should return the corresponding method as an TQ3XFunctionPointer.
  639.  *
  640.  *        IMPORTANT: A metaHandler MUST always "return" a value. If you are
  641.  *        passed a methodType that you do not understand, ALWAYS return NULL.
  642.  *
  643.  *        These types here are prototypes of how your functions should look.
  644.  */
  645. typedef CALLBACK_API_C( TQ3Status , TQ3XObjectUnregisterMethod )(TQ3XObjectClass objectClass);
  646. /*
  647.  * See QD3DIO.h for the IO method types: 
  648.  *        ObjectReadData, ObjectTraverse, ObjectWrite
  649.  */
  650.  
  651. /******************************************************************************
  652.  **                                                                             **
  653.  **                                Set Types                                     **
  654.  **                                                                             **
  655.  *****************************************************************************/
  656. typedef long                             TQ3ElementType;
  657.  
  658. enum {
  659.     kQ3ElementTypeNone            = 0,
  660.     kQ3ElementTypeUnknown        = 32,
  661.     kQ3ElementTypeSet            = 33
  662. };
  663.  
  664.  
  665. /* 
  666.  *    kQ3ElementTypeUnknown is a TQ3Object. 
  667.  *    
  668.  *        Do Q3Set_Add(s, ..., &obj) or Q3Set_Get(s, ..., &obj);
  669.  *        
  670.  *        Note that the object is always referenced when copying around. 
  671.  *        
  672.  *        Generally, it is an Unknown object, a Group of Unknown objects, or a 
  673.  *        group of other "objects" which have been found in the metafile and
  674.  *        have no attachment method to their parent. Be prepared to handle
  675.  *        any or all of these cases if you actually access the set on a shape.
  676.  *
  677.  *    kQ3ElementTypeSet is a TQ3SetObject. 
  678.  *    
  679.  *        Q3Shape_GetSet(s,&o) is eqivalent to 
  680.  *            Q3Shape_GetElement(s, kQ3ElementTypeSet, &o)
  681.  *            
  682.  *        Q3Shape_SetSet(s,o)  is eqivalent to 
  683.  *            Q3Shape_SetElement(s, kQ3ElementTypeSet, &o)
  684.  *    
  685.  *        Note that the object is always referenced when copying around. 
  686.  *        
  687.  *    See the note below about the Set and Shape changes.
  688.  */
  689.  
  690. /******************************************************************************
  691.  **                                                                             **
  692.  **                            Object System Macros                             **
  693.  **                                                                             **
  694.  *****************************************************************************/
  695.  
  696. #define Q3_FOUR_CHARACTER_CONSTANT(a,b,c,d)         \
  697.             ((const unsigned long)                     \
  698.             ((const unsigned long) (a) << 24) |     \
  699.             ((const unsigned long) (b) << 16) |        \
  700.             ((const unsigned long) (c) << 8)  |     \
  701.             ((const unsigned long) (d)))
  702.  
  703. #define Q3_OBJECT_TYPE(a,b,c,d) \
  704.     ((TQ3ObjectType) Q3_FOUR_CHARACTER_CONSTANT(a,b,c,d))
  705.  
  706. #define Q3_METHOD_TYPE(a,b,c,d) \
  707.     ((TQ3XMethodType) Q3_FOUR_CHARACTER_CONSTANT(a,b,c,d))
  708.  
  709. /******************************************************************************
  710.  **                                                                             **
  711.  **                                Object Types                                 **
  712.  **                                                                             **
  713.  *****************************************************************************/
  714. /*
  715.  * Note:    a call to Q3Foo_GetType will return a value kQ3FooTypeBar
  716.  *            e.g. Q3Shared_GetType(object) returns kQ3SharedTypeShape, etc.
  717.  */
  718.  
  719. #define kQ3ObjectTypeInvalid                            0L
  720. #define kQ3ObjectTypeView                                ((TQ3ObjectType)FOUR_CHAR_CODE('view'))
  721. #define kQ3ObjectTypeElement                            ((TQ3ObjectType)FOUR_CHAR_CODE('elmn'))
  722.     #define kQ3ElementTypeAttribute                        ((TQ3ObjectType)FOUR_CHAR_CODE('eatt'))
  723. #define kQ3ObjectTypePick                                ((TQ3ObjectType)FOUR_CHAR_CODE('pick'))
  724.     #define kQ3PickTypeWindowPoint                        ((TQ3ObjectType)FOUR_CHAR_CODE('pkwp'))
  725.     #define kQ3PickTypeWindowRect                        ((TQ3ObjectType)FOUR_CHAR_CODE('pkwr'))
  726. #define kQ3ObjectTypeShared                                ((TQ3ObjectType)FOUR_CHAR_CODE('shrd'))
  727.     #define kQ3SharedTypeRenderer                        ((TQ3ObjectType)FOUR_CHAR_CODE('rddr'))
  728.         #define kQ3RendererTypeWireFrame                ((TQ3ObjectType)FOUR_CHAR_CODE('wrfr'))
  729.         #define kQ3RendererTypeGeneric                    ((TQ3ObjectType)FOUR_CHAR_CODE('gnrr'))
  730.         #define kQ3RendererTypeInteractive                ((TQ3ObjectType)FOUR_CHAR_CODE('ctwn'))
  731.     #define kQ3SharedTypeShape                            ((TQ3ObjectType)FOUR_CHAR_CODE('shap'))
  732.  
  733.             
  734.         #define kQ3ShapeTypeGeometry                    ((TQ3ObjectType)FOUR_CHAR_CODE('gmtr'))
  735.             #define kQ3GeometryTypeBox                    ((TQ3ObjectType)FOUR_CHAR_CODE('box '))
  736.             #define kQ3GeometryTypeGeneralPolygon        ((TQ3ObjectType)FOUR_CHAR_CODE('gpgn'))
  737.             #define kQ3GeometryTypeLine                    ((TQ3ObjectType)FOUR_CHAR_CODE('line'))
  738.             #define kQ3GeometryTypeMarker                ((TQ3ObjectType)FOUR_CHAR_CODE('mrkr'))
  739.             #define kQ3GeometryTypePixmapMarker            ((TQ3ObjectType)FOUR_CHAR_CODE('mrkp'))
  740.             #define kQ3GeometryTypeMesh                    ((TQ3ObjectType)FOUR_CHAR_CODE('mesh'))
  741.             #define kQ3GeometryTypeNURBCurve            ((TQ3ObjectType)FOUR_CHAR_CODE('nrbc'))
  742.             #define kQ3GeometryTypeNURBPatch            ((TQ3ObjectType)FOUR_CHAR_CODE('nrbp'))
  743.             #define kQ3GeometryTypePoint                ((TQ3ObjectType)FOUR_CHAR_CODE('pnt '))
  744.             #define kQ3GeometryTypePolygon                ((TQ3ObjectType)FOUR_CHAR_CODE('plyg'))
  745.             #define kQ3GeometryTypePolyLine                ((TQ3ObjectType)FOUR_CHAR_CODE('plyl'))
  746.             #define kQ3GeometryTypeTriangle                ((TQ3ObjectType)FOUR_CHAR_CODE('trng'))
  747.             #define kQ3GeometryTypeTriGrid                ((TQ3ObjectType)FOUR_CHAR_CODE('trig'))
  748.             #define kQ3GeometryTypeCone                    ((TQ3ObjectType)FOUR_CHAR_CODE('cone'))
  749.             #define kQ3GeometryTypeCylinder                ((TQ3ObjectType)FOUR_CHAR_CODE('cyln'))
  750.             #define kQ3GeometryTypeDisk                    ((TQ3ObjectType)FOUR_CHAR_CODE('disk'))
  751.             #define kQ3GeometryTypeEllipse                ((TQ3ObjectType)FOUR_CHAR_CODE('elps'))
  752.             #define kQ3GeometryTypeEllipsoid            ((TQ3ObjectType)FOUR_CHAR_CODE('elpd'))
  753.             #define kQ3GeometryTypePolyhedron            ((TQ3ObjectType)FOUR_CHAR_CODE('plhd'))
  754.             #define kQ3GeometryTypeTorus                ((TQ3ObjectType)FOUR_CHAR_CODE('tors'))
  755.             #define kQ3GeometryTypeTriMesh                ((TQ3ObjectType)FOUR_CHAR_CODE('tmsh'))
  756.  
  757.             
  758.         #define kQ3ShapeTypeShader                        ((TQ3ObjectType)FOUR_CHAR_CODE('shdr'))
  759.             #define kQ3ShaderTypeSurface                ((TQ3ObjectType)FOUR_CHAR_CODE('sush'))
  760.                 #define kQ3SurfaceShaderTypeTexture        ((TQ3ObjectType)FOUR_CHAR_CODE('txsu'))
  761.             #define kQ3ShaderTypeIllumination            ((TQ3ObjectType)FOUR_CHAR_CODE('ilsh'))
  762.                 #define kQ3IlluminationTypePhong        ((TQ3ObjectType)FOUR_CHAR_CODE('phil'))
  763.                 #define kQ3IlluminationTypeLambert        ((TQ3ObjectType)FOUR_CHAR_CODE('lmil'))
  764.                 #define kQ3IlluminationTypeNULL            ((TQ3ObjectType)FOUR_CHAR_CODE('nuil'))
  765.         #define kQ3ShapeTypeStyle                        ((TQ3ObjectType)FOUR_CHAR_CODE('styl'))
  766.             #define kQ3StyleTypeBackfacing                ((TQ3ObjectType)FOUR_CHAR_CODE('bckf'))
  767.             #define kQ3StyleTypeInterpolation            ((TQ3ObjectType)FOUR_CHAR_CODE('intp'))
  768.             #define kQ3StyleTypeFill                    ((TQ3ObjectType)FOUR_CHAR_CODE('fist'))
  769.             #define kQ3StyleTypePickID                    ((TQ3ObjectType)FOUR_CHAR_CODE('pkid'))
  770.             #define kQ3StyleTypeReceiveShadows            ((TQ3ObjectType)FOUR_CHAR_CODE('rcsh'))
  771.             #define kQ3StyleTypeHighlight                ((TQ3ObjectType)FOUR_CHAR_CODE('high'))
  772.             #define kQ3StyleTypeSubdivision                ((TQ3ObjectType)FOUR_CHAR_CODE('sbdv'))
  773.             #define kQ3StyleTypeOrientation                ((TQ3ObjectType)FOUR_CHAR_CODE('ofdr'))
  774.             #define kQ3StyleTypePickParts                ((TQ3ObjectType)FOUR_CHAR_CODE('pkpt'))
  775.             #define kQ3StyleTypeAntiAlias                ((TQ3ObjectType)FOUR_CHAR_CODE('anti'))
  776.  
  777.             
  778.         #define kQ3ShapeTypeTransform                    ((TQ3ObjectType)FOUR_CHAR_CODE('xfrm'))
  779.             #define kQ3TransformTypeMatrix                ((TQ3ObjectType)FOUR_CHAR_CODE('mtrx'))
  780.             #define kQ3TransformTypeScale                ((TQ3ObjectType)FOUR_CHAR_CODE('scal'))
  781.             #define kQ3TransformTypeTranslate            ((TQ3ObjectType)FOUR_CHAR_CODE('trns'))
  782.             #define kQ3TransformTypeRotate                ((TQ3ObjectType)FOUR_CHAR_CODE('rott'))
  783.             #define kQ3TransformTypeRotateAboutPoint     ((TQ3ObjectType)FOUR_CHAR_CODE('rtap'))
  784.             #define kQ3TransformTypeRotateAboutAxis     ((TQ3ObjectType)FOUR_CHAR_CODE('rtaa'))
  785.             #define kQ3TransformTypeQuaternion            ((TQ3ObjectType)FOUR_CHAR_CODE('qtrn'))
  786.             #define kQ3TransformTypeReset                ((TQ3ObjectType)FOUR_CHAR_CODE('rset'))
  787.         #define kQ3ShapeTypeLight                        ((TQ3ObjectType)FOUR_CHAR_CODE('lght'))
  788.             #define kQ3LightTypeAmbient                    ((TQ3ObjectType)FOUR_CHAR_CODE('ambn'))
  789.             #define kQ3LightTypeDirectional                ((TQ3ObjectType)FOUR_CHAR_CODE('drct'))
  790.             #define kQ3LightTypePoint                    ((TQ3ObjectType)FOUR_CHAR_CODE('pntl'))
  791.             #define kQ3LightTypeSpot                    ((TQ3ObjectType)FOUR_CHAR_CODE('spot'))
  792.         #define kQ3ShapeTypeCamera                        ((TQ3ObjectType)FOUR_CHAR_CODE('cmra'))
  793.             #define kQ3CameraTypeOrthographic            ((TQ3ObjectType)FOUR_CHAR_CODE('orth'))
  794.             #define kQ3CameraTypeViewPlane                ((TQ3ObjectType)FOUR_CHAR_CODE('vwpl'))
  795.             #define kQ3CameraTypeViewAngleAspect        ((TQ3ObjectType)FOUR_CHAR_CODE('vana'))
  796.         #define kQ3ShapeTypeGroup                        ((TQ3ObjectType)FOUR_CHAR_CODE('grup'))
  797.             #define kQ3GroupTypeDisplay                    ((TQ3ObjectType)FOUR_CHAR_CODE('dspg'))
  798.                 #define kQ3DisplayGroupTypeOrdered        ((TQ3ObjectType)FOUR_CHAR_CODE('ordg'))
  799.                 #define kQ3DisplayGroupTypeIOProxy        ((TQ3ObjectType)FOUR_CHAR_CODE('iopx'))
  800.             #define kQ3GroupTypeLight                    ((TQ3ObjectType)FOUR_CHAR_CODE('lghg'))
  801.             #define kQ3GroupTypeInfo                    ((TQ3ObjectType)FOUR_CHAR_CODE('info'))
  802.  
  803.             
  804.         #define kQ3ShapeTypeUnknown                        ((TQ3ObjectType)FOUR_CHAR_CODE('unkn'))
  805.             #define kQ3UnknownTypeText                    ((TQ3ObjectType)FOUR_CHAR_CODE('uktx'))
  806.             #define kQ3UnknownTypeBinary                ((TQ3ObjectType)FOUR_CHAR_CODE('ukbn'))
  807.         #define kQ3ShapeTypeReference                    ((TQ3ObjectType)FOUR_CHAR_CODE('rfrn'))
  808.             #define kQ3ReferenceTypeExternal            ((TQ3ObjectType)FOUR_CHAR_CODE('rfex'))
  809.     #define kQ3SharedTypeSet                            ((TQ3ObjectType)FOUR_CHAR_CODE('set '))
  810.         #define kQ3SetTypeAttribute                        ((TQ3ObjectType)FOUR_CHAR_CODE('attr'))
  811.     #define kQ3SharedTypeDrawContext                    ((TQ3ObjectType)FOUR_CHAR_CODE('dctx'))
  812.         #define kQ3DrawContextTypePixmap                ((TQ3ObjectType)FOUR_CHAR_CODE('dpxp'))
  813.         #define kQ3DrawContextTypeMacintosh                ((TQ3ObjectType)FOUR_CHAR_CODE('dmac'))
  814.         #define kQ3DrawContextTypeWin32DC                ((TQ3ObjectType)FOUR_CHAR_CODE('dw32'))
  815.         #define kQ3DrawContextTypeDDSurface                ((TQ3ObjectType)FOUR_CHAR_CODE('ddds'))
  816.         #define kQ3DrawContextTypeX11                    ((TQ3ObjectType)FOUR_CHAR_CODE('dx11'))
  817.     #define kQ3SharedTypeTexture                        ((TQ3ObjectType)FOUR_CHAR_CODE('txtr'))
  818.         #define kQ3TextureTypePixmap                    ((TQ3ObjectType)FOUR_CHAR_CODE('txpm'))    
  819.         #define kQ3TextureTypeMipmap                    ((TQ3ObjectType)FOUR_CHAR_CODE('txmm'))    
  820.  
  821.             
  822.     #define kQ3SharedTypeFile                            ((TQ3ObjectType)FOUR_CHAR_CODE('file'))
  823.     #define kQ3SharedTypeStorage                        ((TQ3ObjectType)FOUR_CHAR_CODE('strg'))
  824.         #define kQ3StorageTypeMemory                    ((TQ3ObjectType)FOUR_CHAR_CODE('mems'))
  825.         #define kQ3MemoryStorageTypeHandle                ((TQ3ObjectType)FOUR_CHAR_CODE('hndl'))
  826.         #define kQ3StorageTypeUnix                        ((TQ3ObjectType)FOUR_CHAR_CODE('uxst'))
  827.         #define kQ3UnixStorageTypePath                    ((TQ3ObjectType)FOUR_CHAR_CODE('unix'))
  828.         #define kQ3StorageTypeMacintosh                    ((TQ3ObjectType)FOUR_CHAR_CODE('macn'))
  829.         #define kQ3MacintoshStorageTypeFSSpec            ((TQ3ObjectType)FOUR_CHAR_CODE('macp'))                    
  830.         #define kQ3StorageTypeWin32                        ((TQ3ObjectType)FOUR_CHAR_CODE('wist'))
  831.     #define kQ3SharedTypeString                            ((TQ3ObjectType)FOUR_CHAR_CODE('strn'))
  832.         #define kQ3StringTypeCString                    ((TQ3ObjectType)FOUR_CHAR_CODE('strc'))
  833.     #define kQ3SharedTypeShapePart                        ((TQ3ObjectType)FOUR_CHAR_CODE('sprt'))
  834.         #define kQ3ShapePartTypeMeshPart                ((TQ3ObjectType)FOUR_CHAR_CODE('spmh'))
  835.             #define kQ3MeshPartTypeMeshFacePart            ((TQ3ObjectType)FOUR_CHAR_CODE('mfac'))
  836.             #define kQ3MeshPartTypeMeshEdgePart            ((TQ3ObjectType)FOUR_CHAR_CODE('medg'))
  837.             #define kQ3MeshPartTypeMeshVertexPart        ((TQ3ObjectType)FOUR_CHAR_CODE('mvtx'))
  838.     #define kQ3SharedTypeControllerState                ((TQ3ObjectType)FOUR_CHAR_CODE('ctst'))
  839.     #define kQ3SharedTypeTracker                        ((TQ3ObjectType)FOUR_CHAR_CODE('trkr'))
  840.     #define kQ3SharedTypeViewHints                        ((TQ3ObjectType)FOUR_CHAR_CODE('vwhn'))
  841.     #define kQ3SharedTypeEndGroup                        ((TQ3ObjectType)FOUR_CHAR_CODE('endg'))
  842.  
  843.  
  844. /******************************************************************************
  845.  **                                                                             **
  846.  **                            QuickDraw 3D System Routines                     **
  847.  **                                                                             **
  848.  *****************************************************************************/
  849. EXTERN_API_C( TQ3Status )
  850. Q3Initialize                    (void);
  851.  
  852. EXTERN_API_C( TQ3Status )
  853. Q3Exit                            (void);
  854.  
  855. EXTERN_API_C( TQ3Boolean )
  856. Q3IsInitialized                    (void);
  857.  
  858. EXTERN_API_C( TQ3Status )
  859. Q3GetVersion                    (unsigned long *        majorRevision,
  860.                                  unsigned long *        minorRevision);
  861.  
  862. /*
  863.  *  Q3GetReleaseVersion returns the release version number,
  864.  *  in the format of the first four bytes of a 'vers' resource
  865.  *  (e.g. 0x01518000 ==> 1.5.1 release).
  866.  */
  867. EXTERN_API_C( TQ3Status )
  868. Q3GetReleaseVersion                (unsigned long *        releaseRevision);
  869.  
  870.  
  871. /******************************************************************************
  872.  **                                                                             **
  873.  **                            ObjectClass Routines                             **
  874.  **                                                                             **
  875.  *****************************************************************************/
  876. /* 
  877.  *  New object system calls to query the object system.
  878.  *
  879.  *  These comments to move to the stubs file before final release, they 
  880.  *  are here for documentation for developers using early seeds.
  881.  */
  882. /*
  883.  *  Given a class name as a string return the associated class type for the 
  884.  *  class, may return kQ3Failure if the string representing the class is 
  885.  *  invalid.
  886.  */
  887. EXTERN_API_C( TQ3Status )
  888. Q3ObjectHierarchy_GetTypeFromString (TQ3ObjectClassNameString  objectClassString,
  889.                                  TQ3ObjectType *        objectClassType);
  890.  
  891. /*
  892.  *  Given a class type as return the associated string for the class name, 
  893.  *  may return kQ3Failure if the type representing the class is invalid.
  894.  */
  895. EXTERN_API_C( TQ3Status )
  896. Q3ObjectHierarchy_GetStringFromType (TQ3ObjectType         objectClassType,
  897.                                  TQ3ObjectClassNameString  objectClassString);
  898.  
  899. /* 
  900.  *  Return true if the class with this type is registered, false if not 
  901.  */
  902. EXTERN_API_C( TQ3Boolean )
  903. Q3ObjectHierarchy_IsTypeRegistered (TQ3ObjectType         objectClassType);
  904.  
  905. /* 
  906.  *  Return true if the class with this name is registered, false if not 
  907.  */
  908. EXTERN_API_C( TQ3Boolean )
  909. Q3ObjectHierarchy_IsNameRegistered (const char *        objectClassName);
  910.  
  911. /*
  912.  * TQ3SubClassData is used when querying the object system for
  913.  * the subclasses of a particular parent type:
  914.  */
  915.  
  916. struct TQ3SubClassData {
  917.     unsigned long                     numClasses;                    /* the # of subclass types found for a parent class */
  918.     TQ3ObjectType *                    classTypes;                    /* an array containing the class types */
  919. };
  920. typedef struct TQ3SubClassData            TQ3SubClassData;
  921. /*
  922.  *  Given a parent type and an instance of the TQ3SubClassData struct fill
  923.  *  it in with the number and class types of all of the subclasses immediately
  924.  *  below the parent in the class hierarchy.  Return kQ3Success to indicate no
  925.  *  errors occurred, else kQ3Failure.
  926.  *
  927.  *  NOTE:  This function will allocate memory for the classTypes array.  Be 
  928.  *    sure to call Q3ObjectClass_EmptySubClassData to free this memory up.
  929.  */
  930. EXTERN_API_C( TQ3Status )
  931. Q3ObjectHierarchy_GetSubClassData (TQ3ObjectType         objectClassType,
  932.                                  TQ3SubClassData *        subClassData);
  933.  
  934. /*
  935.  *  Given an instance of the TQ3SubClassData struct free all memory allocated 
  936.  *    by the Q3ObjectClass_GetSubClassData call.
  937.  *
  938.  *  NOTE: This call MUST be made after a call to Q3ObjectClass_GetSubClassData
  939.  *  to avoid memory leaks.
  940.  */
  941. EXTERN_API_C( TQ3Status )
  942. Q3ObjectHierarchy_EmptySubClassData (TQ3SubClassData *    subClassData);
  943.  
  944.  
  945. /******************************************************************************
  946.  **                                                                             **
  947.  **                                Object Routines                                 **
  948.  **                                                                             **
  949.  *****************************************************************************/
  950. EXTERN_API_C( TQ3Status )
  951. Q3Object_Dispose                (TQ3Object                 object);
  952.  
  953. EXTERN_API_C( TQ3Object )
  954. Q3Object_Duplicate                (TQ3Object                 object);
  955.  
  956. EXTERN_API_C( TQ3Status )
  957. Q3Object_Submit                    (TQ3Object                 object,
  958.                                  TQ3ViewObject             view);
  959.  
  960. EXTERN_API_C( TQ3Boolean )
  961. Q3Object_IsDrawable                (TQ3Object                 object);
  962.  
  963. EXTERN_API_C( TQ3Boolean )
  964. Q3Object_IsWritable                (TQ3Object                 object,
  965.                                  TQ3FileObject             theFile);
  966.  
  967.  
  968. /******************************************************************************
  969.  **                                                                             **
  970.  **                            Object Type Routines                             **
  971.  **                                                                             **
  972.  *****************************************************************************/
  973. EXTERN_API_C( TQ3ObjectType )
  974. Q3Object_GetType                (TQ3Object                 object);
  975.  
  976. EXTERN_API_C( TQ3ObjectType )
  977. Q3Object_GetLeafType            (TQ3Object                 object);
  978.  
  979. EXTERN_API_C( TQ3Boolean )
  980. Q3Object_IsType                    (TQ3Object                 object,
  981.                                  TQ3ObjectType             theType);
  982.  
  983.  
  984. /******************************************************************************
  985.  **                                                                             **
  986.  **                            Shared Object Routines                             **
  987.  **                                                                             **
  988.  *****************************************************************************/
  989. EXTERN_API_C( TQ3ObjectType )
  990. Q3Shared_GetType                (TQ3SharedObject         sharedObject);
  991.  
  992. EXTERN_API_C( TQ3SharedObject )
  993. Q3Shared_GetReference            (TQ3SharedObject         sharedObject);
  994.  
  995. /* 
  996.  *    Q3Shared_IsReferenced
  997.  *        Returns kQ3True if there is more than one reference to sharedObject.
  998.  *        Returns kQ3False if there is ONE reference to sharedObject.
  999.  *    
  1000.  *    This call is intended to allow applications and plug-in objects to delete
  1001.  *    objects of which they hold THE ONLY REFERENCE. This is useful when
  1002.  *    caching objects, etc.
  1003.  *    
  1004.  *    Although many may be tempted, DO NOT DO THIS:
  1005.  *        while (Q3Shared_IsReferenced(foo)) { Q3Object_Dispose(foo); }
  1006.  *    
  1007.  *    Your application will crash and no one will buy it. Chapter 11 is 
  1008.  *    never fun (unless you short the stock). Thanks.
  1009.  */
  1010. EXTERN_API_C( TQ3Boolean )
  1011. Q3Shared_IsReferenced            (TQ3SharedObject         sharedObject);
  1012.  
  1013. /*
  1014.  *    Q3Shared_GetEditIndex
  1015.  *        Returns the "serial number" of sharedObject. Usefuly for caching 
  1016.  *        object information. Returns 0 on error.
  1017.  *        
  1018.  *        Hold onto this number to determine if an object has changed since you
  1019.  *        last built your caches... To validate, do:
  1020.  *        
  1021.  *        if (Q3Shared_GetEditIndex(foo) == oldFooEditIndex) {
  1022.  *            // Cache is valid
  1023.  *        } else {
  1024.  *            // Cache is invalid
  1025.  *            RebuildSomeSortOfCache(foo);
  1026.  *            oldFooEditIndex = Q3Shared_GetEditIndex(foo);
  1027.  *        }
  1028.  */
  1029. EXTERN_API_C( unsigned long )
  1030. Q3Shared_GetEditIndex            (TQ3SharedObject         sharedObject);
  1031.  
  1032. /*
  1033.  *    Q3Shared_Edited
  1034.  *        Bumps the "serial number" of sharedObject to a different value. This
  1035.  *        call is intended to be used solely from a plug-in object which is 
  1036.  *        shared. Call this whenever your private instance data changes.
  1037.  *        
  1038.  *        Returns kQ3Failure iff sharedObject is not a shared object, OR
  1039.  *            QuickDraw 3D isn't initialized.
  1040.  */
  1041. EXTERN_API_C( TQ3Status )
  1042. Q3Shared_Edited                    (TQ3SharedObject         sharedObject);
  1043.  
  1044.  
  1045. /******************************************************************************
  1046.  **                                                                             **
  1047.  **                                Shape Routines                                 **
  1048.  **                                                                             **
  1049.  *****************************************************************************/
  1050. /*
  1051.  *    QuickDraw 3D 1.5 Note:
  1052.  *
  1053.  *    Shapes and Sets are now (sort of) polymorphic.
  1054.  *
  1055.  *        You may call Q3Shape_Foo or Q3Set_Foo on a shape or a set.
  1056.  *        The following calls are identical, in implementation:
  1057.  *
  1058.  *            Q3Shape_GetElement            =    Q3Set_Get
  1059.  *            Q3Shape_AddElement            =    Q3Set_Add
  1060.  *            Q3Shape_ContainsElement        =    Q3Set_Contains
  1061.  *            Q3Shape_GetNextElementType    =    Q3Set_GetNextElementType
  1062.  *            Q3Shape_EmptyElements        =    Q3Set_Empty
  1063.  *            Q3Shape_ClearElement        =    Q3Set_Clear
  1064.  *
  1065.  *    All of these calls accept a shape or a set as their first parameter.
  1066.  *
  1067.  *    The Q3Shape_GetSet and Q3ShapeSetSet calls are implemented via a new
  1068.  *    element type kQ3ElementTypeSet. See the note above about 
  1069.  *    kQ3ElementTypeSet;
  1070.  *
  1071.  *    It is important to note that the new Q3Shape_...Element... calls do not
  1072.  *    create a set on a shape and then add the element to it. This data is
  1073.  *    attached directly to the shape. Therefore, it is possible for an element
  1074.  *    to exist on a shape without a set existing on it as well. 
  1075.  *
  1076.  *    In your application, if you attach an element to a shape like this:
  1077.  *        (this isn't checking for errors for simplicity)
  1078.  *
  1079.  *        set = Q3Set_New();
  1080.  *        Q3Set_AddElement(set, kMyElemType, &data);
  1081.  *        Q3Shape_SetSet(shape, set);
  1082.  *
  1083.  *    You should retrieve it in the same manner:
  1084.  *
  1085.  *        Q3Shape_GetSet(shape, &set);
  1086.  *        if (Q3Set_Contains(set, kMyElemType) == kTrue) {
  1087.  *            Q3Set_Get(set, kMyElemType, &data);
  1088.  *        }
  1089.  *
  1090.  *    Similarly, if you attach data to a shape with the new calls:
  1091.  *
  1092.  *        Q3Shape_AddElement(shape, kMyElemType, &data);
  1093.  *
  1094.  *    You should retrieve it in the same manner:
  1095.  *
  1096.  *        if (Q3Shape_ContainsElement(set, kMyElemType) == kTrue) {
  1097.  *            Q3Shape_GetElement(set, kMyElemType, &data);
  1098.  *        }
  1099.  *
  1100.  *    This really becomes an issue when dealing with version 1.0 and version 1.1 
  1101.  *    metafiles.
  1102.  *
  1103.  *    When attempting to find a particular element on a shape, you should
  1104.  *    first check with Q3Shape_GetNextElementType or Q3Shape_GetElement, then,
  1105.  *    Q3Shape_GetSet(s, &set) (or Q3Shape_GetElement(s, kQ3ElementTypeSet, &set))
  1106.  *    and then Q3Shape_GetElement(set, ...).
  1107.  *
  1108.  *    In terms of implementation, Q3Shape_SetSet and Q3Shape_GetSet should only be
  1109.  *    used for sets of information that are shared among multiple shapes.
  1110.  *    
  1111.  *    Q3Shape_AddElement, Q3Shape_GetElement, etc. calls should only be used
  1112.  *    for elements that are unique for a particular shape.
  1113.  *    
  1114.  */
  1115. EXTERN_API_C( TQ3ObjectType )
  1116. Q3Shape_GetType                    (TQ3ShapeObject         shape);
  1117.  
  1118. EXTERN_API_C( TQ3Status )
  1119. Q3Shape_GetSet                    (TQ3ShapeObject         shape,
  1120.                                  TQ3SetObject *            theSet);
  1121.  
  1122. EXTERN_API_C( TQ3Status )
  1123. Q3Shape_SetSet                    (TQ3ShapeObject         shape,
  1124.                                  TQ3SetObject             theSet);
  1125.  
  1126. EXTERN_API_C( TQ3Status )
  1127. Q3Shape_AddElement                (TQ3ShapeObject         shape,
  1128.                                  TQ3ElementType         theType,
  1129.                                  const void *            data);
  1130.  
  1131. EXTERN_API_C( TQ3Status )
  1132. Q3Shape_GetElement                (TQ3ShapeObject         shape,
  1133.                                  TQ3ElementType         theType,
  1134.                                  void *                    data);
  1135.  
  1136. EXTERN_API_C( TQ3Boolean )
  1137. Q3Shape_ContainsElement            (TQ3ShapeObject         shape,
  1138.                                  TQ3ElementType         theType);
  1139.  
  1140. EXTERN_API_C( TQ3Status )
  1141. Q3Shape_GetNextElementType        (TQ3ShapeObject         shape,
  1142.                                  TQ3ElementType *        theType);
  1143.  
  1144. EXTERN_API_C( TQ3Status )
  1145. Q3Shape_EmptyElements            (TQ3ShapeObject         shape);
  1146.  
  1147. EXTERN_API_C( TQ3Status )
  1148. Q3Shape_ClearElement            (TQ3ShapeObject         shape,
  1149.                                  TQ3ElementType         theType);
  1150.  
  1151.  
  1152. /******************************************************************************
  1153.  **                                                                             **
  1154.  **                            Color Table Routines                             **
  1155.  **                                                                             **
  1156.  *****************************************************************************/
  1157. EXTERN_API_C( TQ3Status )
  1158. Q3Bitmap_Empty                    (TQ3Bitmap *            bitmap);
  1159.  
  1160. EXTERN_API_C( unsigned long )
  1161. Q3Bitmap_GetImageSize            (unsigned long             width,
  1162.                                  unsigned long             height);
  1163.  
  1164.  
  1165.  
  1166.  
  1167. #if PRAGMA_ENUM_ALWAYSINT
  1168.     #pragma enumsalwaysint reset
  1169. #elif PRAGMA_ENUM_OPTIONS
  1170.     #pragma option enum=reset
  1171. #elif defined(PRAGMA_ENUM_PACK__QD3D__)
  1172.     #pragma options(pack_enums)
  1173. #endif
  1174.  
  1175. #if PRAGMA_STRUCT_ALIGN
  1176.     #pragma options align=reset
  1177. #elif PRAGMA_STRUCT_PACKPUSH
  1178.     #pragma pack(pop)
  1179. #elif PRAGMA_STRUCT_PACK
  1180.     #pragma pack()
  1181. #endif
  1182.  
  1183. #ifdef PRAGMA_IMPORT_OFF
  1184. #pragma import off
  1185. #elif PRAGMA_IMPORT
  1186. #pragma import reset
  1187. #endif
  1188.  
  1189. #ifdef __cplusplus
  1190. }
  1191. #endif
  1192.  
  1193. #endif /* __QD3D__ */
  1194.  
  1195.